import config from '../config';
import { CanvasEnum } from '../enum';
import { ICanvas } from '../types';

export default abstract class ModelAbstract {
  abstract render(): void;
  abstract name: string;
  abstract canvas: ICanvas;
  public width = config.cell.width;
  public height = config.cell.height;
  constructor(public x: number, public y: number) {}

  protected draw(modelName: CanvasEnum) {
    switch (modelName) {
      case CanvasEnum.board:
        return this.canvas.ctx.strokeRect(
          this.x,
          this.y,
          config.cell.width,
          config.cell.height
        );
      case CanvasEnum.cell:
        this.canvas.ctx.fillStyle = '#000';
        this.canvas.ctx.fillRect(
          this.x,
          this.y,
          config.cell.width,
          config.cell.height
        );
        return;
      default:
        break;
    }
  }
}
